Skip to content

Conversation

@Will-ShaoHua
Copy link
Contributor

Problem

  • Before
    customization is bound to a specific idc instance

  • After
    customization is bound to a specific Q profile and an idc instance can have multi profiles

therefore each Q profile will have access to different sets of customization

Solution

We need to validate if the selected customization is accessible from the user's selected profile, otherwise will get

*An error occurred while processing your request.*
This error is reported to the team automatically. We will attempt to fix it as soon as possible.
Details: The provided profile ARN and customization ARN is mismatched. (Service: CodeWhispererRuntime, Status Code: 403, 

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Will-ShaoHua Will-ShaoHua requested review from a team as code owners April 15, 2025 16:58
@github-actions
Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.

@justinmk3 justinmk3 changed the title fix(amazonq): validate customization on proifle change fix(amazonq): validate customization on profile change Apr 15, 2025
@Will-ShaoHua Will-ShaoHua marked this pull request as draft April 15, 2025 18:34
@Will-ShaoHua
Copy link
Contributor Author

ew

 ERROR in Circular dependency detected:
  ../core/dist/src/codewhisperer/client/codewhisperer.js -> ../core/dist/src/codewhisperer/util/authUtil.js -> ../core/dist/src/codewhisperer/region/regionProfileManager.js -> ../core/dist/src/codewhisperer/util/customizationUtil.js -> ../core/dist/src/codewhisperer/client/codewhisperer.js

  ERROR in Circular dependency detected:
  ../core/dist/src/codewhisperer/region/regionProfileManager.js -> ../core/dist/src/codewhisperer/util/customizationUtil.js -> ../core/dist/src/codewhisperer/util/authUtil.js -> ../core/dist/src/codewhisperer/region/regionProfileManager.js

  ERROR in Circular dependency detected:
  ../core/dist/src/codewhisperer/util/authUtil.js -> ../core/dist/src/codewhisperer/region/regionProfileManager.js -> ../core/dist/src/codewhisperer/util/customizationUtil.js -> ../core/dist/src/codewhisperer/util/authUtil.js

  ERROR in Circular dependency detected:
  ../core/dist/src/codewhisperer/util/customizationUtil.js -> ../core/dist/src/codewhisperer/util/authUtil.js -> ../core/dist/src/codewhisperer/region/regionProfi

@Will-ShaoHua Will-ShaoHua marked this pull request as ready for review April 15, 2025 22:22
@Will-ShaoHua Will-ShaoHua requested a review from justinmk3 April 15, 2025 23:06
.then(async (customizations) => {
const r = customizations.find((it) => it.arn === selectedCustomization.arn)
if (!r) {
await switchToBaseCustomizationAndNotify()
Copy link
Contributor

@justinmk3 justinmk3 Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switchToBaseCustomizationAndNotify() is not slow (no network calls), so it's ok for it to be await'd, right?

If you want it to be async also, then would be:

switchToBaseCustomizationAndNotify().catch(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, thanks for explanation :)

@justinmk3 justinmk3 merged commit d6d839a into aws:master Apr 15, 2025
29 of 31 checks passed
@Will-ShaoHua Will-ShaoHua deleted the custom branch April 16, 2025 06:27
Will-ShaoHua added a commit that referenced this pull request Apr 21, 2025
## Problem

followup of #7049 

as mentioned in #7049
```
Before we introduced QProfile
    customization is bound to a specific idc instance

After
    customization is bound to a specific Q profile and an idc instance can have multi profiles

in other words, each Q profile will have access to different sets of customization
```



## Solution

Product team wants us to show all customizations across profiles instead
of the connected one only. By that mean, when users select a
customization, it might implicitly change the profile for users in the
selected customization is not accessible by the current profile. The
purpose is to reduce the churn users might be lost what profile has
access to what customization.


## user story

1. click "select customization" button from the menu
-> should show "all" customizations across profiles

2. select a customization under different profile
-> should change the profile to the one owning the newly selected
customization

3. select a profile which doesn't have access to the selected
customization
-> should fallback to "default" and prompt ui saying you don't have
access to the customization




### Implicity change profile when user selects a customization under a
different profile


https://github.com/user-attachments/assets/49bfe61f-04a7-4d07-aaff-1e3c284fb710


### Change profile should validate if the selected customization is
under the new profile or not




https://github.com/user-attachments/assets/414f85dd-50a1-4d28-9b33-e59691f25a0c







Note that customization will have only 1 profile owner, so there wont be
duplicate customization across profiles

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants